import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import VueRouter from 'vue-router'

// 引入全局样式和字体图标
import '@/assets/css/global.css'
import '@/assets/fonts/iconfont.css'
Vue.use(VueRouter) 
// 引入下载的依赖vant
import vant from 'vant';
// 引入css样式表
import 'vant/lib/index.css'

Vue.use(vant) //挂载vant

Vue.config.productionTip = false

/* 引入axios */
import axios from 'axios'
Vue.prototype.$axios = axios

const eventBus = new Vue()
Vue.prototype.eventBus = eventBus
// 在main.js中进行配置， 配置elementUI
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);

axios.interceptors.request.use(config=>{
    // 通过config参数 设置请求头 携带token
      config.headers['Authorization'] = localStorage.getItem('token')
      //返回config
      return config
  })
  
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')